class Semaphor::Reports::TopUri < Semaphor::Reports::Base
  
  self.category = "General"
  self.title = "Top 25 URLs"
  self.template = :rank
  self.cols = [
    ['count', "Hits"],
    ['percent', "%"],
    ['request_uri', "URL"]
  ]
  
  def run
  	query = %{
      SELECT COUNT(*) AS count,
              request_uri,
              COUNT(*) / (SELECT COUNT(*) FROM hits) * 100 AS percent
      FROM hits 
      GROUP BY request_uri 
      ORDER BY count DESC 
      LIMIT 25
    }

    @data = db.select_all(query)
  end
    
end
